package com.pacy.pacybaseproject.fragments;

import android.graphics.Color;
import android.os.Bundle;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.ViewGroup;


import androidx.core.content.ContextCompat;

import com.fondesa.recyclerviewdivider.DividerBuilder;
import com.pacy.pacybaseproject.BR;
import com.pacy.pacybaseproject.R;
import com.pacy.pacybaseproject.base.BaseXFragment;
import com.pacy.pacybaseproject.databinding.FragmentHomeBinding;
import com.pacy.pacybaseproject.databinding.FragmentMineBinding;
import com.pacy.pacybaseproject.viewmodels.HomeViewModel;
import com.pacy.pacybaseproject.viewmodels.MineViewModel;
import com.xuexiang.xui.utils.StatusBarUtils;
import com.xuexiang.xui.utils.ViewUtils;

import io.reactivex.annotations.Nullable;
import me.goldze.mvvmhabit.utils.ScreenUtil;

/**
 * @author PACY
 * @date 2023/12/20
 * description: 我的
 */
public class MineFragment extends BaseXFragment<FragmentMineBinding, MineViewModel> {

    public static MineFragment newInstance(String title) {

        Bundle args = new Bundle();
        args.putString("title", title);
        MineFragment fragment = new MineFragment();
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public int initContentView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        return R.layout.fragment_mine;
    }

    @Override
    public int initVariableId() {
        return BR.viewModel;
    }

    @Override
    public void initData() {
        super.initData();
        ViewUtils.setPaddingTop( binding.myTopLin, StatusBarUtils.getStatusBarHeight(getContext())+ ScreenUtil.dp2px(20));
        if (binding.recyclerView.getItemDecorationCount() == 0) {
            new DividerBuilder(getContext())
                    .size(1, TypedValue.COMPLEX_UNIT_DIP)
                    .color(ContextCompat.getColor(getContext(),R.color.bgColor))
//                    .showFirstDivider()
//                    .showLastDivider()
                    .build().addTo(binding.recyclerView);
        }


    }
}
